﻿(function(Ctn){
Ctn.extend(Ctn,{
    //创建类对象
    Class: {
        create: function() {
            return function() {
                //调用构造函数
                this._construct.apply(this, arguments);
//                this.addListener = function(fn, cb, args, obj){};
//                this.removeListener = function(fn, cb){};
            }
        }
    },
    //遍历尝试
    tryeach:function(){
        var ret;
        for (var i = 0, l = arguments.length; i < l; i++) {
          var fn = arguments[i];
          try {
            ret = fn();
            break;
          } catch (e) {}
        }
        return ret;
    },
    debug: function(msg){
        Ctn(document.body).append('<div>' + msg + '</div>');
    },
    //空函数
    emptyFn:function(){},
    //获取文档高度
    getDocHeight: function(){
        var wh = Ctn(window).height();
        var dh = Ctn(document).height();
        if (Ctn.browser.ie('6-')){
            dh = dh - 4 > wh ? dh : wh;
        }
        return Math.max(wh, dh) - 1;
    },
    getDocWidth: function(){
        var ww = Ctn(window).width();
        var dw = Ctn(document).width();
        if (Ctn.browser.ie('6-')){
            dw -= 22;
        } else if (Ctn.browser.SF){
            ww -= 17;
        }
        return Math.max(ww, dw);
    }
});
})(Ctn);